import requests

class TpshopRegisterApi:

    def get_verify_code(self,session):
        session.get("http://hmshop-test.itheima.net/index.php?m=Home&c=User&a=verify&type=user_reg")

    def tpshop_register(self,session,req_data):
        resp = session.post(url="http://hmshop-test.itheima.net/Home/User/reg.html",
                            data=req_data)
        return resp
if __name__ == '__main__':
    tpshop = TpshopRegisterApi()
    session = requests.Session()
    tpshop.get_verify_code(session)
    req_data = {
        "username":"15099004321",
        "verify_code":"8888",
        "password":"A123456",
        "password2":"A123456"}
    resp = tpshop.tpshop_register(session,req_data)
    print("注册成功：",resp.json())


